﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Calculate
    {
        public int protected1;
        public int protected2;
        
        //public Calculate(int protected1, int protected2)
        //{
        //    this.protected1 = protected1;
        //    this.protected2 = protected2;
        //}
        public int Protected1 { get; set; }
        public int Protected2 { get; set; }
        
        public void yhjs() 
        {
            Console.WriteLine("请输入第一个数");
            this.protected1 = int.Parse(Console.ReadLine());
            Console.WriteLine("请输入第二个数");
            this.protected2 = int.Parse(Console.ReadLine());
        }
        

        public virtual void DisplayResult()
        {
            int sum;
            Console.WriteLine("请输入操作符");
            string key = Console.ReadLine();
            switch (key)
            {
                case "+":
                    //yhjs();
                    //Class1 class1 = new Class1();
                    //sum= this.protected1 + this.protected2;
                    //Console.WriteLine("sum="+sum);
                    Class1 class1 = new Class1();
                    class1.DisplayResult();

                    break;
                case "-":
                    //yhjs();
                    //Class2 class2 = new Class2();
                    //sum = this.protected1 - this.protected2;
                    //Console.WriteLine("sum=" + sum);
                    Class2 class2 = new Class2();
                    class2.DisplayResult();
                    break;
                case "*":
                    //yhjs();
                    //Class3 class3 = new Class3();
                    //sum = this.protected1 * this.protected2;
                    //Console.WriteLine("sum=" + sum);
                    Class3 class3 = new Class3();
                    class3.DisplayResult();
                    break;
                case "/":
                    //yhjs();
                    //Class4 class4 = new Class4();
                    //sum = this.protected1 / this.protected2;
                    //Console.WriteLine("sum=" + sum);
                    Class4 class4 = new Class4();
                    class4.DisplayResult();
                    break;
                default:
                    Console.WriteLine("这不是操作符重新输入");
                    DisplayResult();
                    break;
            }
        }
    }
}
